package com.parktech.sun.utils.action;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ConfigUtil {
	
	private static Properties properties;

	public static String URL;
	
	public static String getConfigValue(String key){
		if(null==properties){
			initProperites();
		}
		return properties.getProperty(key);
	}
	
	private static void initProperites(){
		String filePath=ConfigUtil.class.getClassLoader().getResource("config.properties").getFile();
    	filePath = filePath.replaceAll("%20", " ");
		try {
			InputStream in = new FileInputStream(filePath);
			properties = new Properties();
			properties.load(in);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
